from tkinter import *
master = Tk()
sb = Scrollbar(master) # 创建一个滑动条
sb.pack(side=RIGHT,fill=Y) # 右边 y轴滑动
lb = Listbox(master,yscrollcommand=sb.set) # yscrollcommand属性是传入set的Scrollbar
for i in range(100):
    lb.insert(END,str(i))
lb.pack()
sb.config(command=lb.yview) #用config 里的command改变
mainloop()